import Message from '../../components/message/message.vue'
import Vue from 'vue'
export default {
  install(Vue) {
    const Profile = Vue.extend(Message)

    // 弹出
    Vue.prototype.$openInvite = function (params) {
      const instance = new Profile()
      instance._props.message = params
      instance.vm = instance.$mount()
      console.log('88888', document, Message)
      const InviteEle = document.body.lastElementChild
      if (InviteEle.className === 'win') return
      setTimeout(() => document.body.appendChild(instance.vm.$el))
      return instance
    }

    // 关闭
    Vue.prototype.$closeInvite = function () {
      const instance = new Profile()
      instance.vm = instance.$mount()
      const InviteEle = document.body.lastElementChild
      if (InviteEle.className !== 'win') return
      document.body.removeChild(InviteEle)
      return instance
    }
  }
}